﻿using UnityEngine;
using System.Collections;

public class WinCondiction : MonoBehaviour {

	public JoggerBuilder _joggerBulider;
	public GUIStyle _style;

	public int amountOfYoursJoggers;
	public int amountOfJoggersFinnished;

	// Use this for initialization
	void Start () {
		amountOfYoursJoggers = _joggerBulider._amountOfJoggersOnTeam - 1;
		amountOfJoggersFinnished = 0;
	}
	
	// Update is called once per frame
	void Update () {
			
		if (amountOfYoursJoggers == amountOfJoggersFinnished)  {
			Application.LoadLevel(2);
		}

	}

	void OnGUI() {
		GUI.Label (new Rect (10, 40, 100, 20), amountOfJoggersFinnished + " / " + amountOfYoursJoggers , _style);
	}

	public void joggerFinnished(){
		amountOfJoggersFinnished++;
	}
}